#pragma once
#include "EngineObject.h"

namespace DreamEngine
{

class _EngineExport CShaderParam
{
public:

enum ParamType
{
	SPT_UNKNOW			= 0,

	SPT_BOOL			= 1,
	SPT_INT				= 2,
	SPT_FLOAT			= 3,
	SPT_MATRIX16		= 4,
	SPT_VECTOR3			= 5,
	SPT_TEXTURE			= 6,

	SPT_ARRY_BASE_VAULE = 20,
	SPT_BOOL_ARRY		= 21,
	SPT_INT_ARRY		= 22,
	SPT_FLOAT_ARRY		= 23,
	SPT_MATRIX16_ARRY	= 24,
	SPT_VECTOR3_ARRY	= 25,
};

static m_byte		SizeOfParamType(ParamType type, m_byte count=1);

friend class CShaderParamTable;

public:

	void					SetAll( ParamType type, 
								    m_uint8 elemCount,
									m_uint8 byteSize, 
									m_uint8 stMembers);
									
	void*					GetDataPtr(void)const		{return m_pData;}
	const CString&			GetName(void)const			{return m_name;}
	ParamType				GetType(void)const			{return m_type;}
	m_uint8					GetElemCount(void)const		{return m_elemCount;}
	m_uint8					GetSize(void)const			{return m_byteSize;}
	m_uint8					GetRegisterIdx(void)const	{return m_registerIdx;}
	m_uint8					GetStMembers(void)const		{return m_stMembers;}

	void					GetDataVaule(void* pData)const;

	void					SetVaule(void* pVaule);
	void					SetDataPtr(void* pData)		{m_pData=pData;}

protected:

	CShaderParam();
	CShaderParam(const CString& name);

	CShaderParam(const CString& name, 
		ParamType type, 
		m_uint8 elemCount,
		m_uint8 byteSize,
		m_uint8 registerIdx,
		m_uint8 stMembers);

	~CShaderParam(void);

protected:

	void*				m_pData;						// data address
						
	CString				m_name;							// Name
	ParamType			m_type;							// Type
	m_uint8				m_elemCount;                    // Number of elements
	m_uint8				m_byteSize;						// size of param
	m_uint8				m_registerIdx;					// register index 
	m_uint8				m_stMembers;					// Number of structure member sub-parameters
};

}


